Skip to content

Conversation

GuillaumeErhard
Copy link
Contributor

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

train.py Outdated
@@ -512,7 +512,7 @@ def main():
**args.model_kwargs,
)
if args.head_init_scale is not None:
with torch.no_grad():
with torch.inference_mode():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should probably remain as no_grad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it works. It does not interfer with the graph / properties of existing variable, and the mul just scale and does not create new params.

I just tried to run train.py for some steps with those params and saw no error
--model resnet18 --dataset hfds/imagenet-1k --head-init-scale .1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the same, would like to revert that to previous... everything else looks good assuming no test fails, which I doubt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rwightman rwightman merged commit 6239313 into huggingface:main Jul 4, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants